const { ipcMain } = require('electron')
const createRegisterWindow = require("./windows/registerwindow")
const createVideoWindow = require("./windows/videowindow")
const connectWs = require('./socket')


module.exports = function (mainWindow) {
    let ws = null
    ipcMain.handle('createRegisterWin', () => {
        createRegisterWindow(mainWindow)
    })

    ipcMain.handle('changeWH',()=>{
        const size = mainWindow.getSize()

        mainWindow.setResizable(true)
        mainWindow.setContentSize(716,size[1])
        mainWindow.setSize(716,size[1])
    })

    ipcMain.handle('handleSendMsg',function (e,msg){
        ws.send(msg)
    })

    ipcMain.handle('connectWs',function (e,id){
        ws = connectWs(id,mainWindow)
        mainWindow.whoAmI = id
    })
}
